package com.btb.core.exception;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import com.btb.adapter.exception.QueryUpChainResultException;
import com.btb.adapter.utils.ResponseText;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@RestControllerAdvice
public class GolbalExceptionHandler {

	@ExceptionHandler(AuthException.class)
	public ResponseText<String> exceptionHandler(AuthException e) {
		log.error("GolbalException ex:{}", e.getMessage(), e);
		return ResponseText.buildFail(e.getMessage());
	}

	@ExceptionHandler(Exception.class)
	public ResponseText<String> exexception(Exception e) {
		log.error("Exexception ex:{}", e.getMessage(), e);
		return ResponseText.buildFail("server error");
	}
}
